//
//  DDDSplashAdView.h
//  DDDDemo
//
//  Created by lishimin on 2020/2/9.
//  Copyright © 2020 summer. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN
@class DDDSplashAdView;
@protocol DDDSplashAdViewDelegate <NSObject>

@optional
/// 素材加载成功时候的回调
/// @param splashAd splashAd
- (void)splashAdDidLoad:(DDDSplashAdView *)splashAd;

/// 关闭时回调
/// @param splashAd splashAd
- (void)splashAdDidClose:(DDDSplashAdView *)splashAd;

/// 加载失败时回调
/// @param splashAd splashAd
/// @param errorCode 错误码
- (void)splashAd:(DDDSplashAdView *)splashAd didFailWithError:(NSInteger)errorCode;

/// 视图即将要显示时的回调
/// @param splashAd splashAd
- (void)splashAdWillVisible:(DDDSplashAdView *)splashAd;

/// 视图被点击的回调
/// @param splashAd splashAd
- (void)splashAdDidClick:(DDDSplashAdView *)splashAd;

/// 视图即将关闭的回调
/// @param splashAd splashAd
- (void)splashAdWillClose:(DDDSplashAdView *)splashAd ;

/// 关闭另一个弹出的控制器时调用
/// @param splashAd splashAd
- (void)splashAdDidCloseOtherController:(DDDSplashAdView *)splashAd ;

/// 点击视图跳过时的回调
/// @param splashAd splashAd
- (void)splashAdDidClickSkip:(DDDSplashAdView *)splashAd;

/// 广告倒计时回调（后期会弃用，慎用）
/// @param splashAd splashAd
- (void)splashAdCountdownToZero:(DDDSplashAdView *)splashAd;

@end
@interface DDDSplashAdView : UIView

@property (nonatomic, weak, nullable) id<DDDSplashAdViewDelegate> delegate;

/// 初始化方法
/// @param frame 视图大小
/// @param window 当前需要显示的window对象
/// @param tolerateTimeout 最大网络超时时间
/// @param hideSkipButton 是否显示跳过按钮
- (instancetype)initWithFrame:(CGRect)frame andRootWindow:(UIWindow *)window andTolerateTimeout:(NSTimeInterval)tolerateTimeout andHideSkipButton:(BOOL)hideSkipButton;


/// 展示视图
/// @param bottom 作用在底部的自定义视图（不存在可以传nil）
- (void)showAdWithBottomView:(UIView * __nullable)bottom;

@end

NS_ASSUME_NONNULL_END
